/* eslint valid-jsdoc: "off" */

"use strict";

require("dotenv").config();

module.exports = () => {
    /**
     * built-in config
     * @type {Egg.EggAppConfig}
     **/
    const config = exports = {};

    // sequelize 连接配置
    config.sequelize = {
        dialect: "mysql",
        host: process.env.DEV_DB_HOST,
        port: process.env.DEV_DB_PORT,
        database: process.env.DEV_DB_DATABASE,
        username: process.env.DEV_DB_USERNAME,
        password: process.env.DEV_DB_PASSWORD,
        pool: {
            max: 5,
            min: 0,
        },
        define: {
            freezeTableName: true, // 冻结表名
            underscored: true,
            createdAt: "created_at", // 自定义时间戳
            updatedAt: "updated_at", // 自定义时间戳
            deletedAt: "deleted_at", // 自定义时间戳
        },
        timezone: "+08:00",
    };

    return config;
};
